<?php if(!defined('BASEPATH'))exit('No direct script access allowed'); ?>
<?php $this->load->view('admin/global/header'); ?>
<?php $this->load->view('admin/global/left'); ?>
<table cellpadding="0" cellspacing="0">
    <tr>
        <td class="title"><?php echo lang('MANAGER').': '.lang('MEDIA'); ?></td>
    </tr>
    <?php if(isset($denied)){ ?>
    <tr>
        <td class="bar">
            <div class="error"><?php echo lang('DENIED'); ?></div>
            <meta http-equiv="refresh" content="5; <?php echo base_url().ADMIN_PATH; ?>" />
        </td>
    </tr>
    <?php }else{ ?>
    <?php echo Modules::run('admin/bar_module/index', $buttons); ?>
    <tr>
        <td valign="top">
        <form name="frmView" id="frmView" method="post">
            <div class="contain" style="overflow:auto;">
                <table class="media" cellpadding="0" cellspacing="0">
                    <tr>
                        <td>
                            <!--LOOP-->
                            <?php if(isset($files)){ ?>
                            <?php if(count($files) > 0){ ?>
                            <?php foreach($files as $file){ ?>
                            <div class="box">
                                <div class="file">
                                    <?php if(strtoupper(substr($file, -4)) != '.SWF'){ ?>
                                    <img src="<?php echo base_url().$path.$file; ?>" class="vtip" title="<?php echo tip(base_url().$path.$file, true); ?>" />
                                    <?php }else{ ?>
                                    <img src="<?php echo base_url(); ?>templates/admin/images/swf.jpg" class="vtip" title="<embed src='<?php echo base_url().$path.$file; ?>'></embed>" />
                                    <?php } ?>
                                    <input type="text" value="<?php echo base_url().$path.$file; ?>" />
                                </div>
                                <input type="checkbox" name="txtMedia[]" value="<?php echo $path.$file; ?>" />
                            </div>
                            <?php } ?>
                            <?php }else{ ?>
                            <div class="error"><?php echo lang('EMPTY_DIR'); ?></div>
                            <?php } ?>
                            <?php }elseif(isset($folders)){ ?>
                            <?php if(count($folders) > 0){ ?>
                            <?php foreach($folders as $folder){ ?>
                            <div class="box">
                                <div class="folder" onclick="redirect('<?php echo $url.$folder; ?>')"><?php echo $folder; ?></div>
                                <input type="checkbox" name="txtMedia[]" value="<?php echo $path.$folder; ?>" <?php if($allowDelete == false){echo 'disabled="disabled"';} ?> />
                            </div>
                            <?php } ?>
                            <?php }else{ ?>
                            <div class="error"><?php echo lang('EMPTY_DIR'); ?></div>
                            <?php } ?>
                            <?php }else{ ?>
                            <div class="error"><?php echo lang('NOT_EXIST_DIR'); ?></div>
                            <?php } ?>
                            <!--LOOP-->
                        </td>
                    </tr>
                </table>
            </div>
            <input type="hidden" name="action" value="" />
            <input type="hidden" name="value" value="" />
        </form>
        </td>
    </tr>
    <?php } ?>
</table>
<?php $this->load->view('admin/global/right'); ?>
<?php $this->load->view('admin/global/footer'); ?>